SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[sp_MSupd_tb_AlumnoDivision] 
 @c1 int,@c2 int,@c3 int,@c4 int,@c5 datetime,@c6 datetime,@c7 int,@c8 int,@c9 varchar(1),@c10 int,@c11 char(20),@c12 datetime,@c13 int,@pkc1 int
,@bitmap binary(2)
as
SET NOCOUNT ON
if substring(@bitmap,1,1) & 1 = 1
begin
update "tb_AlumnoDivision" set
"idRelDivisionAlumno" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idRelDivisionAlumno" end
,"Alumno" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Alumno" end
,"Division" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "Division" end
,"AnioLectivo" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "AnioLectivo" end
,"Desde" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Desde" end
,"Hasta" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Hasta" end
,"PaseDeOrigen" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "PaseDeOrigen" end
,"InscripcionDeOrigen" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "InscripcionDeOrigen" end
,"Baja" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Baja" end
,"CausaBaja" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "CausaBaja" end
,"cargo" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "cargo" end
,"hora" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "hora" end
,"previas" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "previas" end
where "idRelDivisionAlumno" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "tb_AlumnoDivision" set
"Alumno" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Alumno" end
,"Division" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "Division" end
,"AnioLectivo" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "AnioLectivo" end
,"Desde" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Desde" end
,"Hasta" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Hasta" end
,"PaseDeOrigen" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "PaseDeOrigen" end
,"InscripcionDeOrigen" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "InscripcionDeOrigen" end
,"Baja" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Baja" end
,"CausaBaja" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "CausaBaja" end
,"cargo" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "cargo" end
,"hora" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "hora" end
,"previas" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "previas" end
where "idRelDivisionAlumno" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
GO
